---
title: Quick Start
description: Build your first AI agent crew in minutes with this step-by-step tutorial
---

import { Tabs, TabItem } from '@astrojs/starlight/components';

Let's build your first langcrew application! In this tutorial, we'll create a simple content creation crew with two agents working together.

## Prerequisites

- **Python 3.10+**
- **An LLM API key** (OpenAI, Anthropic, DashScope, or Google)

## Installation

Quick installation with pip:

```bash
pip install langcrew
export OPENAI_API_KEY=your_openai_key
```

:::tip[Need more installation options?]
For detailed installation instructions, optional dependencies, Docker deployment, and other LLM providers, see the **[Installation Guide](/guides/installation)**.
:::

## What We'll Build

A content creation system where:

1. A **Researcher** agent gathers information on a topic
2. A **Writer** agent creates an article based on the research

## Step 1: Import Required Components

```python
from langcrew import Agent, Task, Crew
from langchain_openai import ChatOpenAI

# Configure LLM
llm = ChatOpenAI(model="gpt-4o")
```

## Step 2: Create Your Agents

### Research Agent

```python
researcher = Agent(
    role="Senior Research Analyst",
    goal="Gather comprehensive information on the given topic",
    backstory="""You are an experienced researcher with a keen eye for 
    credible sources and relevant information. You excel at finding and 
    synthesizing data from multiple sources.""",
    tools=["web_search", "web_fetch"],  # Built-in tools
    llm=llm,
    verbose=True
)
```

### Writer Agent

```python
writer = Agent(
    role="Content Writer",
    goal="Create engaging and informative content based on research",
    backstory="""You are a skilled writer who transforms research into 
    compelling narratives. You have a talent for making complex topics 
    accessible to readers.""",
    llm=llm,
    verbose=True
)
```

## Step 3: Define Tasks

### Research Task

```python
research_task = Task(
    description="""Research the topic: 'The Impact of AI on Healthcare'
    
    Your research should include:
    - Current applications of AI in healthcare
    - Benefits and challenges
    - Future possibilities
    - Real-world examples and case studies
    
    Provide a comprehensive research summary.""",
    agent=researcher,
    expected_output="A detailed research report on AI in healthcare"
)
```

### Writing Task

```python
writing_task = Task(
    description="""Using the research provided, write an engaging article 
    about 'The Impact of AI on Healthcare'.
    
    The article should:
    - Have a compelling introduction
    - Cover key points from the research
    - Include specific examples
    - Be approximately 500 words
    - End with a thought-provoking conclusion""",
    agent=writer,
    context=[research_task],  # This task depends on research_task
    expected_output="A well-written article on AI in healthcare"
)
```

## Step 4: Assemble Your Crew

```python
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, writing_task],
    verbose=True
)
```

## Step 5: Execute the Crew

```python
# Start the crew's work
result = crew.kickoff()

# Display the final result
print("=" * 50)
print("FINAL ARTICLE:")
print("=" * 50)
print(result)
```

## Complete Example

```python
from langcrew import Agent, Task, Crew
from langchain_openai import ChatOpenAI

# Configure LLM
llm = ChatOpenAI(model="gpt-4o")

# Create agents
researcher = Agent(
    role="Senior Research Analyst",
    goal="Gather comprehensive information on the given topic",
    backstory="""You are an experienced researcher with a keen eye for 
    credible sources and relevant information.""",
    tools=["web_search", "web_fetch"],
    llm=llm,
    verbose=True
)

writer = Agent(
    role="Content Writer",
    goal="Create engaging and informative content",
    backstory="""You are a skilled writer who transforms research into 
    compelling narratives.""",
    llm=llm,
    verbose=True
)

# Define tasks
research_task = Task(
    description="Research the topic: 'The Impact of AI on Healthcare'",
    agent=researcher,
    expected_output="A detailed research report"
)

writing_task = Task(
    description="Write an engaging article based on the research",
    agent=writer,
    context=[research_task],
    expected_output="A well-written article"
)

# Create and run crew
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, writing_task],
    verbose=True
)

result = crew.kickoff()
print(result)
```

## Customization Options

### Adding Human Input

```python
from langcrew_tools.hitl import UserInputTool

agent = Agent(
    role="Interactive Agent",
    tools=[UserInputTool()],
    # ... other parameters
)
```

### Custom Tools

```python
from langcrew.tools import tool

@tool
def custom_calculator(expression: str) -> str:
    """Evaluate a mathematical expression."""
    try:
        result = eval(expression)
        return f"The result is: {result}"
    except Exception as e:
        return f"Error: {str(e)}"

agent = Agent(
    tools=[custom_calculator],
    # ... other parameters
)
```

## Tips for Success

1. **Start Simple**: Begin with 2-3 agents and gradually add complexity
2. **Clear Roles**: Give each agent a specific, well-defined role
3. **Task Dependencies**: Use context to share information between tasks
4. **Iterate**: Refine agent prompts and task descriptions based on results
5. **Monitor Output**: Use verbose mode during development to understand agent behavior

Ready to build more complex crews? Check out our [advanced examples](https://github.com/01-ai/langcrew/tree/main/examples)!
